﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Zeus.DAL.EntityFramework.RepoUnit;
using Zeus.Biz.Northwind.Model;
using Zeus.Biz.DAL.EF.Northwind;

namespace Zeus.Biz.Northwind.BLL
{
    public class EmployeeLogic
    {
        public List<Employee> GetAllEmployees()
        {
            using (var context = new NorthwindContext("NorthwindConnection"))
            {
                var empRep = new GenericRepository<Employee>(context);

                return empRep.GetAll().ToList();
            }
        }

        public bool ModifyEmployee(Employee employee)
        {
            using (var context = new NorthwindContext("NorthwindConnection"))
            {
                var empRep = new GenericRepository<Employee>(context);

                int result = empRep.Update(employee);

                if (result != 0)
                    return true;
                else
                    return false;
            }
        }
    }
}
